home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / prog_c / cuj0696.zip / DWYER.ZIP / SPECTRAL.TST / SPECTRAL.TXT < prev    next >
Text File  |  1996-01-26  |  5KB  |  175 lines

  1. .HE "/ /Description of Program Spectral/\*(DA/"
  2. .na
  3. INTRODUCTION
  4. .sp
  5. The purpose of program spectral is to check the quality of
  6. multiplier and modulus of linear congruential random number
  7. generators. One-parameter and two-parameter generators can be handled.
  8. .sp
  9. Program spectral implements Knuth's Algorithm S (The Spectral
  10. Test) [1, pp. 89-113].  The underlying theory is described on
  11. pages 89-98 of [1].  The algorithm implemented is described on
  12. pages 98-105.  The generalization described in exercise 24,
  13. page 113 of [1] has also been implemented.
  14. .sp
  15. Program spectral employs software written by Steve Moshier [2]
  16. to do 100-digit extended precision arithmetic.
  17. .sp
  18. This document describes how to use program spectral.
  19. .sp 2
  20. HOW TO USE PROGRAM SPECTRAL
  21. .sp
  22. Program spectral resides on disk as spectral.exe.  Standard units
  23. are used for input and output:
  24. .sp
  25. .ai
  26.     stderr    - Prompts for inputs and and error messages
  27.     stdin    - Input data
  28.     stdout    - Results
  29. .sp
  30. .fi
  31. Start program spectral by issuing the command
  32. .sp
  33.     spectral
  34. .sp
  35. at the command line.
  36. .sp
  37. My favorite input technique is to prepare an input file with the
  38. required data, one item per line.  Then the redirect the input unit
  39. with:
  40. .sp
  41.     sepctral < [file name]
  42. .sp
  43. If you decide to enter the data directly, you will be prompted for
  44. input data as follows:
  45. .sp
  46. .ai
  47.     How Many Multipliers? [1 or 2]:
  48.     Enter Multiplier:
  49.     Enter Modulus:
  50.     Enter Maximum Dimension:
  51. .sp
  52. .fi
  53. The text shown is produced when you respond '1' to the first prompt.
  54. You must enter either 1 or 2.  If you don't, program spectral issues a
  55. warning message and asks you to reenter the input:
  56. .sp
  57. .ai
  58.     How Many Multipliers? [1 or 2]: 3
  59.     Incorrect Response: 3
  60.     How Many Multipliers? [1 or 2]:
  61. .sp
  62. .fi
  63. .ne 2
  64. The following prompts are produced when you respond '2' to the
  65. first prompt:
  66. .sp
  67. .ai
  68.     How Many Multipliers? [1 or 2]: 2
  69.     Enter First  Multiplier:
  70.     Enter Second Multiplier:
  71.     Enter Modulus:
  72.     Enter Maximum Dimension:
  73. .sp
  74. .fi
  75. For example, to replicate the numbers on line 27, page 102 of [1] your
  76. responses must be:
  77. .sp
  78. .ai
  79.     How Many Multipliers? [1 or 2]: 1
  80.     Enter Multiplier:               314159269
  81.     Enter Modulus:                  2147483647
  82.     Enter Maximum Dimension:        6
  83. .sp
  84. .fi
  85. The only two-parameter generator illustrated in [1] is given on line~28.
  86. Here is what your responses must be:
  87. .sp
  88. .ai
  89.     How Many Multipliers? [1 or 2]: 2
  90.     Enter First  Multiplier:        271828183
  91.     Enter Second Multiplier:        -314159269
  92.     Enter Modulus:                  2147483647
  93.     Enter Maximum Dimension:        6
  94. .sp
  95. .fi
  96. A requirement of the Spectral Test is that the multiplier(s) and the
  97. modulus be relatively prime. When this is not the case, you will be
  98. advised with a printout like the following:
  99. .sp
  100. .ai
  101.     Multiplier and modulus not relatively prime.
  102.     GCD of Multiplier and Modulus =  xxxx
  103.     Error(s) detected in input data
  104. .sp
  105. .fi
  106. The minimum dimension that is tested is 2. If you enter something
  107. less than that your input is silently ignored.
  108. .sp 2
  109. OUTPUT FROM PROGRAM SPECTRAL
  110. .sp
  111. Standard Printouts
  112. .br
  113. ------------------
  114. .sp
  115. The first few lines of output echo your inputs. Thereafter,
  116. the results of the Spectral Test are printed - two lines per
  117. dimension requested.  For example, when the test cited above
  118. for line 27 from [1] is run, the following output is produced:
  119. .sp
  120. .ai
  121.                 1                    Number of Multipliers
  122.                 314159269            Multiplier
  123.                 2147483647           Modulus
  124.                 6                    Maximum Dimension of Test
  125. 2-Dimensional Accuracy =  1432232969  No. Bits:  15.2
  126. 2-Dimensional Merit    =  2.10        (Good > 0.1, Great > 1.0)
  127. 3-Dimensional Accuracy =  899290      No. Bits:  9.9
  128. 3-Dimensional Merit    =  1.66        (Good > 0.1, Great > 1.0)
  129. 4-Dimensional Accuracy =  36985       No. Bits:  7.6
  130. 4-Dimensional Merit    =  3.14        (Good > 0.1, Great > 1.0)
  131. 5-Dimensional Accuracy =  3427        No. Bits:  5.9
  132. 5-Dimensional Merit    =  1.69        (Good > 0.1, Great > 1.0)
  133. 6-Dimensional Accuracy =  1144        No. Bits:  5.1
  134. 6-Dimensional Merit    =  3.60        (Good > 0.1, Great > 1.0)
  135. .sp
  136. .fi
  137. The numbers that you see in this example exactly replicate those
  138. given in [1].  The output you see here has been cropped to fit on
  139. the page.
  140. .sp
  141. Error Printouts
  142. .br
  143. ---------------
  144. .sp
  145. As stated previously, you must enter 1 or 2 to the first prompt.
  146. Failure to do so can result is severe mental anguish, to wit:
  147. .sp
  148. .ai
  149.     How Many Multipliers? [1 or 2]: 3 <-- Uncalled for
  150.     Incorrect Response: 3
  151.     How Many Multipliers? [1 or 2]:
  152. .sp
  153. .fi
  154. It is a requirement that the multiplier(s) under test and the
  155. modulus be relatively prime.  When this is not the case, you
  156. are shown the error of your ways as follows:
  157. .sp
  158. .ai
  159.     How Many Multipliers? [1 or 2]: 1
  160.     Enter Multiplier:        314159269
  161.     Enter Modulus:            2147483639
  162.     Multiplier and modulus not relatively prime.
  163.     GCD of Multiplier and Modulus =  17
  164.     Error(s) detected in input data
  165. .sp
  166. .fi
  167. REFERENCES
  168. .sp
  169. 1.~Donald E. Knuth, The Art of Computer Programming, Second
  170. Edition, Vol. 2, Seminumerical Algorithms, Addison-Wesley,
  171. Reading, Mass. (1981).
  172. .sp
  173. 2.~Steven L. Moshier, Methods and Programs for Mathematical
  174. Functions, Prentice-Hall (1989)
  175.